home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / Xaw / TextP.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  10KB  |  322 lines

  1. /*
  2. * $Xorg: TextP.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $
  3. */
  4.  
  5.  
  6. /***********************************************************
  7.  
  8. Copyright 1987, 1988, 1994, 1998  The Open Group
  9.  
  10. Permission to use, copy, modify, distribute, and sell this software and its
  11. documentation for any purpose is hereby granted without fee, provided that
  12. the above copyright notice appear in all copies and that both that
  13. copyright notice and this permission notice appear in supporting
  14. documentation.
  15.  
  16. The above copyright notice and this permission notice shall be included in
  17. all copies or substantial portions of the Software.
  18.  
  19. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  22. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  
  26. Except as contained in this notice, the name of The Open Group shall not be
  27. used in advertising or otherwise to promote the sale, use or other dealings
  28. in this Software without prior written authorization from The Open Group.
  29.  
  30.  
  31. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
  32.  
  33.                         All Rights Reserved
  34.  
  35. Permission to use, copy, modify, and distribute this software and its 
  36. documentation for any purpose and without fee is hereby granted, 
  37. provided that the above copyright notice appear in all copies and that
  38. both that copyright notice and this permission notice appear in 
  39. supporting documentation, and that the name of Digital not be
  40. used in advertising or publicity pertaining to distribution of the
  41. software without specific, written prior permission.  
  42.  
  43. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  44. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  45. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  46. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  47. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  48. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  49. SOFTWARE.
  50.  
  51. ******************************************************************/
  52. /* $XFree86: xc/lib/Xaw/TextP.h,v 3.21 2001/12/14 19:54:44 dawes Exp $ */
  53.  
  54. #ifndef _XawTextP_h
  55. #define _XawTextP_h
  56.  
  57. #include <X11/Xfuncproto.h>
  58.  
  59. #include <X11/Xaw/Text.h>
  60. #include <X11/Xaw/SimpleP.h>
  61.  
  62. _XFUNCPROTOBEGIN
  63.  
  64. #define MAXCUT    30000    /* Maximum number of characters that can be cut */
  65.  
  66. #define XawTextGetLastPosition(ctx)                \
  67.     XawTextSourceScan((ctx)->text.source, 0,        \
  68.               XawstAll, XawsdRight, 1, True)
  69. #define GETLASTPOS    XawTextGetLastPosition(ctx)
  70.  
  71. #define zeroPosition ((XawTextPosition)0)
  72.  
  73. extern XtActionsRec _XawTextActionsTable[];
  74. extern Cardinal _XawTextActionsTableCount;
  75.  
  76. #define XawLF      0x0a
  77. #define XawCR      0x0d
  78. #define XawTAB      0x09
  79. #define XawBS      0x08
  80. #define XawSP      0x20
  81. #define XawDEL      0x7f
  82. #define XawESC      0x1b
  83. #define XawBSLASH '\\'
  84.  
  85. /* constants that subclasses may want to know */
  86. #define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
  87. #define DEFAULT_TAB_SIZE    8
  88.  
  89. /* displayable text management data structures */
  90. typedef struct {
  91.     XawTextPosition position;
  92.     Position y;
  93. #ifndef OLDXAW
  94.     unsigned int textWidth;
  95. #else
  96.     Dimension textWidth;
  97. #endif
  98. } XawTextLineTableEntry, *XawTextLineTableEntryPtr;
  99.  
  100. typedef struct {
  101.     XawTextPosition left, right;
  102.     XawTextSelectType type;
  103.     Atom *selections;
  104.     int atom_count;
  105.     int array_size;
  106. } XawTextSelection;
  107.  
  108. typedef struct _XawTextSelectionSalt {
  109.     struct _XawTextSelectionSalt *next;
  110.     XawTextSelection    s;
  111.     /* 
  112.      * The element "contents" stores the CT string which is gotten in the
  113.      * function _XawTextSaltAwaySelection()
  114.     */ 
  115.     char        *contents;
  116.     int            length;
  117. } XawTextSelectionSalt;
  118.  
  119. #ifndef OLDXAW
  120. typedef struct _XawTextKillRing {
  121.     struct _XawTextKillRing *next;
  122.     char *contents;
  123.     int length;
  124.     unsigned refcount;
  125.     unsigned long format;
  126. } XawTextKillRing;
  127.  
  128. extern XawTextKillRing *xaw_text_kill_ring;
  129. #endif
  130.  
  131. /* Line Tables are n+1 long - last position displayed is in last lt entry */
  132. typedef struct {
  133.     XawTextPosition top;     /* Top of the displayed text */
  134.     int lines;             /* How many lines in this table */
  135. #ifndef OLDXAW
  136.     int base_line;         /* line number of first entry */
  137. #endif
  138.     XawTextLineTableEntry *info; /* A dynamic array, one entry per line  */
  139. } XawTextLineTable, *XawTextLineTablePtr;
  140.  
  141. typedef struct _XawTextMargin {
  142.     Position left, right, top, bottom;
  143. } XawTextMargin;
  144.  
  145. typedef struct _XmuScanline XmuTextUpdate;
  146.  
  147. #define VMargins(ctx)  ((ctx)->text.margin.top + (ctx)->text.margin.bottom)
  148. #define HMargins(ctx)  ((ctx)->text.left_margin + (ctx)->text.margin.right)
  149. #define RVMargins(ctx) ((ctx)->text.r_margin.top + (ctx)->text.r_margin.bottom)
  150. #define RHMargins(ctx) ((ctx)->text.r_margin.left + (ctx)->text.r_margin.right)
  151.  
  152. #define IsPositionVisible(ctx, pos) \
  153. (pos >= ctx->text.lt.info[0].position && \
  154.          pos < ctx->text.lt.info[ctx->text.lt.lines].position)
  155.  
  156. /*
  157.  * Search & Replace data structure
  158.  */
  159. struct SearchAndReplace {
  160.     Boolean selection_changed;    /* flag so that the selection cannot be
  161.                    changed out from underneath query-replace.*/
  162.     Widget search_popup;    /* The poppup widget that allows searches.*/
  163.     Widget label1;        /* The label widgets for the search window. */
  164.     Widget label2;
  165.     Widget left_toggle;     /* The left search toggle radioGroup. */
  166.     Widget right_toggle;    /* The right search toggle radioGroup. */
  167.     Widget rep_label;        /* The Replace label string. */
  168.     Widget rep_text;        /* The Replace text field. */
  169.     Widget search_text;     /* The Search text field. */
  170.     Widget rep_one;        /* The Replace one button. */
  171.     Widget rep_all;        /* The Replace all button. */
  172. #ifndef OLDXAW
  173.     Widget case_sensitive;    /* The "Case Sensitive" toggle */
  174. #endif
  175. };
  176.  
  177. /* New fields for the Text widget class record */
  178. typedef struct {
  179.   XtPointer extension;
  180. } TextClassPart;
  181.  
  182. /* Full class record declaration */
  183. typedef struct _TextClassRec {
  184.     CoreClassPart    core_class;
  185.     SimpleClassPart    simple_class;
  186.     TextClassPart    text_class;
  187. } TextClassRec;
  188.  
  189. extern TextClassRec textClassRec;
  190.  
  191. /* New fields for the Text widget record */
  192. typedef struct _TextPart {
  193.     /* resources */
  194.     Widget source, sink;
  195.     XawTextPosition insertPos;
  196.     XawTextSelection s;
  197.     XawTextSelectType *sarray;             /* Array to cycle for selections */
  198.     XawTextSelectionSalt *salt;             /* salted away selections */
  199.     int left_margin;
  200.     int dialog_horiz_offset, dialog_vert_offset; /* position for popup dialog */
  201.     Boolean display_caret;             /* insertion pt visible iff T */
  202.     Boolean auto_fill;                 /* Auto fill mode? */
  203.     XawTextScrollMode scroll_vert, scroll_horiz;
  204.     XawTextWrapMode wrap;             /* The type of wrapping */
  205.     XawTextResizeMode resize;
  206.     XawTextMargin r_margin;             /* The real margins */
  207. #ifndef OLDXAW
  208.     XtCallbackList position_callbacks;
  209. #else
  210.     XtPointer pad1;
  211. #endif
  212.  
  213.     /* private state */
  214.     XawTextMargin margin;             /* The current margins */
  215.     XawTextLineTable lt;
  216.     XawTextScanDirection extendDir;
  217.     XawTextSelection origSel;             /* the selection being modified */
  218.     Time lasttime;                 /* timestamp of last processed action */
  219.     Time time;                     /* time of last key or button action */
  220.     Position ev_x, ev_y;             /* x, y coords for key or button action */
  221.     Widget vbar, hbar;                 /* The scroll bars (none = NULL) */
  222.     struct SearchAndReplace *search;         /* Search and replace structure */
  223.     Widget file_insert;                 /* The file insert popup widget */
  224.     XmuTextUpdate *update;             /* Position intervals to update */
  225. #ifndef OLDXAW
  226.     int line_number;
  227.     short column_number;
  228.     unsigned char kill_ring;
  229.     Boolean selection_state;
  230. #else
  231.     XtPointer pad2;
  232.     int pad3;
  233. #endif
  234.     int from_left;                 /* Cursor position */
  235.     XawTextPosition lastPos;             /* Last position of source */
  236.     GC gc;
  237.     Boolean showposition;             /* True if we need to show the position */
  238.     Boolean hasfocus;                 /* TRUE if we currently have input focus*/
  239.     Boolean update_disabled;             /* TRUE if display updating turned off */
  240.     Boolean clear_to_eol;             /* Clear to eol when painting text? */
  241.     XawTextPosition old_insert;             /* Last insertPos for batched updates */
  242.     short mult;                     /* Multiplier */
  243. #ifndef OLDXAW
  244.     XawTextKillRing *kill_ring_ptr;
  245. #else
  246.     XtPointer pad4;
  247. #endif
  248.  
  249.     /* private state, shared w/Source and Sink */
  250.     Boolean redisplay_needed;             /* in SetValues */
  251.     XawTextSelectionSalt *salt2;         /* salted away selections */
  252.  
  253. #ifndef OLDXAW
  254.     char numeric;
  255.     char source_changed;
  256.     Boolean overwrite;                      /* Overwrite mode */
  257.  
  258.     /* new resources and states, for text edition
  259.      * Note: a fixed width font is required for these resources/states.
  260.      */
  261.     short left_column, right_column;
  262.     XawTextJustifyMode justify;
  263.     XtPointer pad[4];    /* for future use and keep binary compatability */
  264. #endif
  265. } TextPart;
  266.  
  267. #define XtRWrapMode    "WrapMode"
  268. #define XtRScrollMode    "ScrollMode"
  269. #define XtRResizeMode    "ResizeMode"
  270. #define XtRJustifyMode    "JustifyMode"
  271.  
  272. /* full instance record */
  273. typedef struct _TextRec {
  274.     CorePart    core;
  275.     SimplePart    simple;
  276.     TextPart    text;
  277. } TextRec;
  278.  
  279. /*
  280.  * Semi-private functions
  281.  * for use by other Xaw modules only
  282.  */
  283. void _XawTextBuildLineTable
  284. (
  285.  TextWidget        ctx,
  286.  XawTextPosition    top_pos,
  287.  _XtBoolean        force_rebuild
  288.  );
  289.  
  290. char *_XawTextGetSTRING
  291. (
  292.  TextWidget        ctx,
  293.  XawTextPosition    left,
  294.  XawTextPosition    right
  295.  );
  296.  
  297. void _XawTextSaltAwaySelection
  298. (
  299.  TextWidget        ctx,
  300.  Atom            *selections,
  301.  int            num_atoms
  302.  );
  303.  
  304. void _XawTextPosToXY
  305. (
  306.  Widget            w,
  307.  XawTextPosition    pos,
  308.  Position        *x,
  309.  Position        *y
  310.  );
  311.  
  312. void _XawTextNeedsUpdating
  313. (
  314.  TextWidget        ctx,
  315.  XawTextPosition    left,
  316.  XawTextPosition    right
  317.  );
  318.  
  319. _XFUNCPROTOEND
  320.  
  321. #endif /* _XawTextP_h */
  322.